import dashboardRequest from '@/utils/dashboardRequest'

// 获取当时工单汇总信息(人员统计头部信息)
export const getHeadInfo = (start, end) => dashboardRequest({
  method: 'get',
  url: `/task-service/task/taskReportInfo/${start}/${end}`
})

// 获取一定时间范围之内的订单总数
export const getOrderCount = (params) => dashboardRequest({
  method: 'get',
  url: '/order-service/report/orderCount',
  params
})

// 获取一定时间范围之内的收入
export const orderAmount = (params) => dashboardRequest({
  method: 'get',
  url: '/order-service/report/orderAmount',
  params
})

// 获取一定时间范围之内的收入
export const getskuTop = (start, end) => dashboardRequest({
  method: 'get',
  url: `/order-service/report/skuTop/10/${start}/${end}`
})

// 获取销售数据echarts
// 获取折线图数据
export const amountCollect = (type, start, end) => dashboardRequest({
  method: 'get',
  url: `/order-service/report/amountCollect/${type}/${start}/${end}`
})
// 获取条形图数据
export const amountCollectBar = (start, end) => dashboardRequest({
  method: 'get',
  url: `/order-service/report/regionCollect/${start}/${end}`
})

// 工单搜索
export const searchGd = (params) => dashboardRequest({
  method: 'get',
  url: '/task-service/task/search',
  params
})

// 运维工单中重新创建工单
export const createGd = (data) => dashboardRequest({
  method: 'post',
  url: '/task-service/task/create',
  data
})
// 获取工单类型
export const getGdType = () => dashboardRequest({
  method: 'get',
  url: '/task-service/taskType/list'
})
// 取消工单
export const cancelGd = (data) => dashboardRequest({
  method: 'post',
  url: `/task-service/task/cancel/${data.taskId}`,
  data
})

// 获取运维工单人员列表
export const getRepireList = (params) => dashboardRequest({
  method: 'get',
  url: `/user-service/user/repairerList/${params}`
})

// 设置自动补货工单阈值
export const autoSupplyConfig = (data) => dashboardRequest({
  method: 'post',
  url: '/task-service/task/autoSupplyConfig/',
  data
})

// 获取补货预警值
export const supplyAlertValue = () => dashboardRequest({
  method: 'get',
  url: '/task-service/task/supplyAlertValue'
})
// 补货详情
export const taskDetails = (id) => dashboardRequest({
  method: 'get',
  url: `/task-service/taskDetails/${id}`
})
// 获取售货机货道详情
export const channelList = (id) => dashboardRequest({
  method: 'get',
  url: `/vm-service/channel/channelList/${id}`
})
// 商品类型搜索
export const getClassList = (params) => dashboardRequest({
  method: 'get',
  url: '/vm-service/skuClass/search',
  params
})
// 修改商品类型
export const editGoodType = (data) => dashboardRequest({
  method: 'PUT',
  url: `/vm-service/skuClass/${data.classId}`,
  data
})
// 新增商品类型
export const addGoodType = (data) => dashboardRequest({
  method: 'POST',
  url: '/vm-service/skuClass',
  data
})
// 商品搜索
export const getGoodsList = (params) => dashboardRequest({
  method: 'get',
  url: '/vm-service/sku/search',
  params
})
// 删除商品类型
export const delGoods = (id) => dashboardRequest({
  method: 'delete',
  url: `/vm-service/skuClass/${id}`
})
// 商品管理-新建上传
export const uploadPic = (data) => dashboardRequest({
  method: 'POST',
  url: '/vm-service/sku',
  data
})
// 商品管理-修改数据
export const editGoodsInfo = (data) => dashboardRequest({
  method: 'put',
  url: `/vm-service/sku/${data.classId}`,
  data
})
// 商品管理-商品数据导入
export const goodsDataInsert = (data) => dashboardRequest({
  method: 'POST',
  url: '/vm-service/sku/upload',
  data
})
